//
//  QZEditAddressVc.m
//  WeiWeiHaircut
//
//  Created by 上官惠阳 on 15/12/10.
//  Copyright © 2015年 超群. All rights reserved.
//

#import "QZEditAddressVc.h"
#import "QZCityVc.h"
#import "QZAddressInfo.h"

@interface QZEditAddressVc ()

@end

@implementation QZEditAddressVc
{
    NSDictionary *_dataDic;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self titleWithSting:@"省"];
    [self addBtnOnNavWithTitle:@"返回" andImageName:@"返回" andTarget:self andAction:@selector(backAction) andFrame:CGRectMake(0, 0, 45, 20) andDirection:left];
    
    [self createTableViewWithPlainStyle:NO andSeparatorStyleNone:NO andBackGroudImageName:nil];
    [self registCellWithClassName:[UITableViewCell class] addIdentifier:@"cell" addHeight:44];
    
    [self requestData];
}
-(void)requestData
{
    [self requestWithKeys:@[@"city_id"] andValues:@[@(0)] andUrlKey:@"City.GetListInfo" isCache:YES];
}
-(void)request_POST_FinishValue:(id)value tagNSString:(NSString *)tag
{
    NSLog(@"value = %@",value);
    NSLog(@"info = %@",value[@"info"]);
    if ([value[@"data"][@"status"] intValue] == 100) {
        NSArray *dataArray = value[@"data"][@"data"][@"list"];
//        _dataDic = dataDic;
        [self.tableSource addObject:dataArray];
        [self.tableView reloadData];
    }
}
-(void)loadCell:(UITableViewCell *)cell atIndexPath:(NSIndexPath *)indexPath
{
    cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    cell.textLabel.text = self.tableSource[indexPath.section][indexPath.row][@"name"];
}
-(void)actionAtIndexPath:(NSIndexPath *)indexPath
{
    QZCityVc *cityVc = [[QZCityVc alloc]init];
    cityVc.isAddaddress = self.isAddAddress;
    cityVc.provinceId  = self.tableSource[indexPath.section][indexPath.row][@"id"];
    cityVc.provinceName = self.tableSource[indexPath.section][indexPath.row][@"name"];
    
    [[QZAddressInfo shared] addressSetobjct:cityVc.provinceName forkey:@"sheng"];
    [[QZAddressInfo shared] addressSetobjct:cityVc.provinceId forkey:@"shengID"];
    
    [self.navigationController pushViewController:cityVc animated:YES];
}
-(NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
{
    return @"全部";
}
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    return 30;
}
-(void)backAction
{
    [self.navigationController popViewControllerAnimated:YES];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];

    
}



@end
